import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _class, _class2;

/**
 * 租户菜单管理
 * @since 2019-12-2
 */
import React from 'react';
import { connect } from 'dva';
import { Bind } from 'lodash-decorators';
import { Button } from 'antd';
import { Content, Header } from 'components/Page';
import { Button as ButtonPermission } from 'components/Permission';
import intl from 'utils/intl';
import notification from 'utils/notification';
import formatterCollections from 'utils/intl/formatterCollections';
import { getCurrentRole } from 'utils/utils';
import Editor from "../Editor";
import ListTable from "./ListTable";
import PermissionSet from "../PermissionSet";
import styles from "../index.less?modules";
var commonPrompt = 'cpaas.common';
var TenantMenuManage = (_dec = connect(function (_ref) {
  var tenantMenuManage = _ref.tenantMenuManage,
      menuConfig = _ref.menuConfig,
      loading = _ref.loading;
  return {
    tenantMenuManage: tenantMenuManage,
    menuConfig: menuConfig,
    queryTreeListLoading: loading.effects['tenantMenuManage/queryTreeList'],
    queryPermissions: loading.effects['tenantMenuManage/queryPermissions'],
    queryParentDir: loading.effects['tenantMenuManage/queryParentDir'],
    queryPermissionSetTree: loading.effects['tenantMenuManage/queryPermissionSetTree'],
    queryPermissionsById: loading.effects['tenantMenuManage/queryPermissionsById'],
    queryPermissionsByIdAll: loading.effects['tenantMenuManage/queryPermissionsByIdAll'],
    // 已分配的权限
    queryLovsByIdAll: loading.effects['tenantMenuManage/queryLovsByIdAll'],
    // 已分配的Lov
    queryCopyMenuListLoading: loading.effects['tenantMenuManage/queryCopyMenuList'],
    // 复制菜单列表
    copyCreateLoading: loading.effects['tenantMenuManage/copyMenu'],
    // 复制并创建菜单
    saveMenuLoading: loading.effects['tenantMenuManage/saveMenu'],
    // 复制并创建菜单
    createMenuLoading: loading.effects['tenantMenuManage/createMenu'],
    // 复制并创建菜单
    enableLoading: loading.effects['tenantMenuManage/enable'],
    // 复制并创建菜单
    disableLoading: loading.effects['tenantMenuManage/disable'],
    // 复制并创建菜单
    queryPermissionsByMenuId: loading.effects['tenantMenuManage/queryPermissionsByMenuId'],
    // 可分配的权限
    queryLovByMenuId: loading.effects['tenantMenuManage/queryLovByMenuId'],
    // 可分配的Lov
    assignPermissions: loading.effects['menuConfig/assignPermissions'],
    // 分配权限
    deletePermissions: loading.effects['menuConfig/deletePermissions'],
    // 删除权限
    setPermissionLoading: loading.effects['menuConfig/setPermissionSetEnable'],
    // 启用/禁用 权限集
    customMenuLoading: loading.effects['menuConfig/queryOrganizationCustomMenu'],
    // 客户化菜单
    currentRoleCode: getCurrentRole().code
  };
}), _dec2 = formatterCollections({
  code: ['ciam.tenantMenu']
}), _dec3 = Bind(), _dec4 = Bind(), _dec5 = Bind(), _dec6 = Bind(), _dec7 = Bind(), _dec8 = Bind(), _dec9 = Bind(), _dec10 = Bind(), _dec11 = Bind(), _dec12 = Bind(), _dec13 = Bind(), _dec14 = Bind(), _dec15 = Bind(), _dec16 = Bind(), _dec17 = Bind(), _dec18 = Bind(), _dec19 = Bind(), _dec(_class = _dec2(_class = (_class2 = /*#__PURE__*/function (_React$Component) {
  _inherits(TenantMenuManage, _React$Component);

  var _super = _createSuper(TenantMenuManage);

  function TenantMenuManage(props) {
    var _this;

    _classCallCheck(this, TenantMenuManage);

    _this = _super.call(this, props);
    _this.tenantForm = void 0;
    _this.searchForm = React.createRef();
    _this.state = {
      permissionSetVisible: false,
      currentRowData: {},
      isCopy: false,
      // 是否复制
      recordCreateFlag: false,
      editorVisible: false,
      processingEnableRow: null,
      isEdit: false,
      expandedRowKeys: []
    };
    return _this;
  }

  _createClass(TenantMenuManage, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      var dispatch = this.props.dispatch;
      var lovCodes = {
        menuPrefix: 'CIAM.MENU_PREFIX',
        // 目录编码前缀
        menuType: 'CIAM.MENU_TYPE' // 菜单类型

      }; // 初始化 值集

      dispatch({
        type: 'tenantMenuManage/updateState',
        payload: {
          list: {}
        }
      });
      this.props.dispatch({
        type: 'tenantMenuManage/init',
        payload: {
          lovCodes: lovCodes
        }
      });
      this.fetchAssignLevelCode();
      this.handleFetchData();
      this.handleQueryLabel();
    }
    /**
     * handleQueryLabel - 查询label列表
     * @param {!object} [payload = {}] - form数据
     * @param {Function} cb - 获取成功的回调函数
     */

  }, {
    key: "handleQueryLabel",
    value: function handleQueryLabel() {
      var _this$props = this.props,
          dispatch = _this$props.dispatch,
          id = _this$props.match.params.id;
      dispatch({
        type: 'tenantMenuManage/queryLabelList',
        payload: {
          tenantId: id
        }
      });
    }
    /**
     * handleQueryLabel - 查询label列表
     * @param {!object} [payload = {}] - form数据
     * @param {Function} cb - 获取成功的回调函数
     */

  }, {
    key: "handleQueryMenuLabel",
    value: function handleQueryMenuLabel(payload) {
      var _this$props2 = this.props,
          dispatch = _this$props2.dispatch,
          id = _this$props2.match.params.id;
      return dispatch({
        type: 'tenantMenuManage/queryMenuLabel',
        payload: {
          payload: payload,
          tenantId: id
        }
      });
    }
    /**
     * 查询数据
     */

  }, {
    key: "handleFetchData",
    value: function handleFetchData() {
      var _this$props3 = this.props,
          dispatch = _this$props3.dispatch,
          match = _this$props3.match;
      var id = match.params.id;
      dispatch({
        type: 'tenantMenuManage/queryTreeList',
        params: {
          tenantId: id
        }
      });
    }
    /**
     * fetchAssignLevelCode - 查询层级<CIAM.RESOURCE_LEVEL>code
     * @return {Array}
     */

  }, {
    key: "fetchAssignLevelCode",
    value: function fetchAssignLevelCode() {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'tenantMenuManage/queryCode',
        payload: {
          lovCode: 'CIAM.RESOURCE_LEVEL'
        }
      });
    }
    /**
     * fetchDir - 查询上级目录
     * @param {object} [params = {}] - 查询参数
     * @param {!string} params.level - 层级
     * @param {Function} cb - 获取成功的回调函数
     */

  }, {
    key: "fetchDir",
    value: function fetchDir(params) {
      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'tenantMenuManage/queryParentDir',
        params: params
      }).then(function (res) {
        if (res) {
          cb(res);
        }
      });
    }
    /**
     * fetchMenuPermissions - 查询菜单权限
     * @param {object} [params = {}] - 查询参数
     * @param {!string} params.level - 层级
     * @param {!number} [params.size=10] - 分页数目
     * @param {!number} [params.page=0] - 当前页
     * @return {Array}
     */

  }, {
    key: "fetchMenuPermissions",
    value: function fetchMenuPermissions(params) {
      var dispatch = this.props.dispatch;
      var currentRowData = this.state.currentRowData;
      return dispatch({
        type: 'tenantMenuManage/queryPermissions',
        params: _objectSpread(_objectSpread({}, params), {}, {
          excludeHasAssignedMenuId: currentRowData.id
        })
      });
    }
    /**
     * fetchPermissionSetTree - 查询菜单权限集树
     * @param {!number} menuId - 菜单ID
     * @param {object} [params = {}] - 查询参数
     * @return {Array}
     */

  }, {
    key: "fetchPermissionSetTree",
    value: function fetchPermissionSetTree(menuId, params) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'tenantMenuManage/queryPermissionSetTree',
        menuId: menuId,
        params: params
      });
    }
  }, {
    key: "fetchPermissionsById",
    value: function fetchPermissionsById(permissionSetId, params) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'tenantMenuManage/queryPermissionsById',
        permissionSetId: permissionSetId,
        params: params
      });
    } // 查询权限集下已分配的权限

  }, {
    key: "fetchPermissionsByIdAll",
    value: function fetchPermissionsByIdAll(permissionSetId, params) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'tenantMenuManage/queryPermissionsByIdAll',
        permissionSetId: permissionSetId,
        params: params
      });
    } // 查询权限集下已分配的Lov

  }, {
    key: "fetchLovsByIdAll",
    value: function fetchLovsByIdAll(permissionSetId, params) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'tenantMenuManage/queryLovsByIdAll',
        permissionSetId: permissionSetId,
        params: params
      });
    }
    /**
     * 复制菜单
     * @param {object} record - 表格行数据
     */

  }, {
    key: "copy",
    value: function copy(record) {
      var id = record.id,
          code = record.code,
          level = record.level,
          type = record.type,
          _record$levelPath = record.levelPath,
          levelPath = _record$levelPath === void 0 ? '' : _record$levelPath,
          description = record.description,
          icon = record.icon,
          quickIndex = record.quickIndex,
          route = record.route,
          sort = record.sort,
          name = record.name,
          parentName = record.parentName,
          virtualFlag = record.virtualFlag,
          parentId = record.parentId,
          tenantId = record.tenantId;
      var initData = {
        currentId: id,
        level: level,
        levelPath: levelPath,
        code: code,
        parentId: parentId,
        tenantId: tenantId,
        parentName: parentName,
        type: type,
        description: description,
        icon: icon,
        quickIndex: quickIndex,
        route: route,
        sort: sort,
        name: name,
        virtualFlag: virtualFlag
      };
      this.setState({
        editorVisible: true,
        currentRowData: initData,
        isCopy: true,
        recordCreateFlag: true
      });
    }
    /**
     * 获取当前节点及其子节点
     */

  }, {
    key: "fetchCopyMenuList",
    value: function fetchCopyMenuList(params) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'tenantMenuManage/queryCopyMenuList',
        params: params
      });
    }
    /**
     * handleCopyCreate - 复制并创建菜单
     * @param {!object} [payload = {}] - form数据
     * @param {Function} cb - 获取成功的回调函数
     */

  }, {
    key: "handleCopyCreate",
    value: function handleCopyCreate(payload) {
      var _this2 = this;

      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'tenantMenuManage/copyMenu',
        payload: payload
      }).then(function (res) {
        if (res) {
          notification.success();
          cb();

          _this2.handleFetchData();
        }
      });
    }
    /**
     * checkMenuDirExists - 校验目录编码是否存在
     * @param {!object} [params = {}] - 条件
     * @param {!string} params.code - 编码
     * @param {!string} params.level - 层级
     * @param {!number} params.tenantId - 租户编码
     * @param {!string} params.type - 类别
     * @return {null|object}
     */

  }, {
    key: "checkMenuDirExists",
    value: function checkMenuDirExists(params) {
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'tenantMenuManage/checkMenuDirExists',
        params: params
      });
    }
  }, {
    key: "openPermissionSetDrawer",
    value: function openPermissionSetDrawer(record) {
      this.setState({
        currentRowData: record,
        permissionSetVisible: true
      });
    }
  }, {
    key: "closePermissionSetDrawer",
    value: function closePermissionSetDrawer() {
      this.setState({
        currentRowData: {},
        permissionSetVisible: false
      });
    }
    /**
     * closeEditor - 关闭编辑右侧弹窗
     */

  }, {
    key: "closeEditor",
    value: function closeEditor() {
      this.setState({
        editorVisible: false,
        currentRowData: {},
        isEdit: false,
        isCopy: false
      });
    }
    /**
     * create - 创建菜单/打开编辑右侧弹窗
     */

  }, {
    key: "create",
    value: function create() {
      var record = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var recordCreateFlag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
      var id = record.id,
          code = record.code;
      var initData = id !== undefined ? {
        level: 'organization',
        code: code,
        parentId: id,
        parentName: record.name
      } : {};
      this.setState({
        recordCreateFlag: recordCreateFlag,
        editorVisible: true,
        currentRowData: initData
      });
    }
    /**
     * createDir - 创建目录
     * @param {!object} [params = {}] - form数据
     * @param {Function} cb - 获取成功的回调函数
     */

  }, {
    key: "createDir",
    value: function createDir(params) {
      var _this3 = this;

      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var _this$props4 = this.props,
          dispatch = _this$props4.dispatch,
          id = _this$props4.match.params.id;
      dispatch({
        type: 'tenantMenuManage/createMenu',
        payload: {
          menu: params,
          tenantId: id
        }
      }).then(function (res) {
        if (res) {
          notification.success();
          cb();

          _this3.handleFetchData();
        }
      });
    }
    /**
     * edit - 编辑菜单/打开编辑右侧弹窗
     * @param {!object} [record = {}] - 当前行数据
     */

  }, {
    key: "edit",
    value: function edit(record, isEdit) {
      this.setState({
        editorVisible: true,
        recordCreateFlag: false,
        currentRowData: record,
        isEdit: isEdit
      });
    }
    /**
     * 启用 禁用
     * @param {*} record
     * @param {*} paramType
     */

  }, {
    key: "setMenuEnable",
    value: function setMenuEnable(record, paramType) {
      var _this4 = this;

      var _this$props5 = this.props,
          dispatch = _this$props5.dispatch,
          id = _this$props5.match.params.id;
      this.setState({
        processingEnableRow: record.id
      });
      dispatch({
        type: paramType === 'disable' ? 'tenantMenuManage/disable' : 'tenantMenuManage/enable',
        payload: {
          id: record.id,
          tenantId: id,
          _token: record._token
        }
      }).then(function (res) {
        if (res) {
          notification.success();

          _this4.handleFetchData();
        }

        _this4.setState({
          processingEnableRow: record.id
        });
      });
    }
    /**
     * saveDir - 保存目录
     * @param {!object} [params = {}] - form数据
     * @param {Function} cb - 获取成功的回调函数
     */

  }, {
    key: "saveDir",
    value: function saveDir(params) {
      var _this5 = this;

      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var _this$props6 = this.props,
          dispatch = _this$props6.dispatch,
          id = _this$props6.match.params.id;
      var payload = Object.assign(params, {
        level: 'organization'
      });
      dispatch({
        type: 'tenantMenuManage/saveMenu',
        payload: {
          menu: payload,
          tenantId: id
        }
      }).then(function (res) {
        if (res) {
          notification.success();
          cb();

          _this5.handleFetchData();
        }
      });
    }
    /**
     * savePermissionSet - 更新权限集
     * @param {!object} [params = {}] - form数据
     * @param {Function} cb - 获取成功的回调函数
     */

  }, {
    key: "savePermissionSet",
    value: function savePermissionSet(params) {
      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'menuConfig/saveDir',
        params: params
      }).then(function (res) {
        if (res) {
          notification.success();
          cb();
        }
      });
    }
    /**
     * createPermissionSet - 新建权限集
     * @param {!object} [params = {}] - form数据
     * @param {Function} cb - 获取成功的回调函数
     */

  }, {
    key: "createPermissionSet",
    value: function createPermissionSet(params) {
      var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'menuConfig/createDir',
        params: params
      }).then(function (res) {
        if (res) {
          notification.success();
          cb();
        }
      });
    }
  }, {
    key: "setPermissionSetEnable",
    value: function setPermissionSetEnable(record, paramType) {
      var cb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function (e) {
        return e;
      };
      var dispatch = this.props.dispatch;
      dispatch({
        type: 'menuConfig/setPermissionSetEnable',
        payload: {
          id: record.id,
          _token: record._token,
          paramType: paramType
        }
      }).then(function (res) {
        if (res) {
          notification.success();
          cb();
        }
      });
    } // 查询权限集下可分配的所有权限

  }, {
    key: "fetchPermissionsByMenuId",
    value: function fetchPermissionsByMenuId(menuId, params) {
      var _this$props7 = this.props,
          dispatch = _this$props7.dispatch,
          id = _this$props7.match.params.id;
      return dispatch({
        type: 'tenantMenuManage/queryPermissionsByMenuId',
        menuId: menuId,
        params: _objectSpread(_objectSpread({}, params), {}, {
          tenantId: id
        })
      });
    }
  }, {
    key: "assignPermissions",
    value: function assignPermissions() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'menuConfig/assignPermissions',
        payload: _objectSpread({}, params)
      });
    }
  }, {
    key: "deletePermissions",
    value: function deletePermissions() {
      var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var dispatch = this.props.dispatch;
      return dispatch({
        type: 'menuConfig/deletePermissions',
        payload: _objectSpread({}, params)
      });
    } // 可分配的Lov

  }, {
    key: "fetchLovByMenuId",
    value: function fetchLovByMenuId(menuId, params) {
      var _this$props8 = this.props,
          dispatch = _this$props8.dispatch,
          id = _this$props8.match.params.id;
      return dispatch({
        type: 'tenantMenuManage/queryLovByMenuId',
        menuId: menuId,
        params: _objectSpread(_objectSpread({}, params), {}, {
          tenantId: id
        })
      });
    }
    /**
     * expandAll - 全部展开
     */

  }, {
    key: "expandAll",
    value: function expandAll() {
      var tenantMenuManage = this.props.tenantMenuManage;
      var list = tenantMenuManage.list; // setSession('ciam-menuConfig-expandedRowKeys', list.rowKeys);

      this.setState({
        expandedRowKeys: list.rowKeys
      });
    }
    /**
     * collapseAll - 全部收起
     */

  }, {
    key: "collapseAll",
    value: function collapseAll() {
      // setSession('ciam-menuConfig-expandedRowKeys', []);
      this.setState({
        expandedRowKeys: []
      });
    }
  }, {
    key: "handleRefresh",
    value: function handleRefresh() {
      this.handleFetchData();
    }
  }, {
    key: "render",
    value: function render() {
      var _this6 = this;

      var _this$props9 = this.props,
          dispatch = _this$props9.dispatch,
          _this$props9$tenantMe = _this$props9.tenantMenuManage,
          tenantMenuManage = _this$props9$tenantMe === void 0 ? {} : _this$props9$tenantMe,
          _this$props9$match = _this$props9.match,
          path = _this$props9$match.path,
          id = _this$props9$match.params.id,
          queryTreeListLoading = _this$props9.queryTreeListLoading,
          queryPermissions = _this$props9.queryPermissions,
          queryParentDir = _this$props9.queryParentDir,
          queryPermissionSetTree = _this$props9.queryPermissionSetTree,
          queryPermissionsById = _this$props9.queryPermissionsById,
          queryPermissionsByIdAll = _this$props9.queryPermissionsByIdAll,
          queryLovsByIdAll = _this$props9.queryLovsByIdAll,
          queryCopyMenuListLoading = _this$props9.queryCopyMenuListLoading,
          copyCreateLoading = _this$props9.copyCreateLoading,
          createMenuLoading = _this$props9.createMenuLoading,
          saveMenuLoading = _this$props9.saveMenuLoading,
          queryPermissionsByMenuId = _this$props9.queryPermissionsByMenuId,
          queryLovByMenuId = _this$props9.queryLovByMenuId,
          assignPermissions = _this$props9.assignPermissions,
          deletePermissions = _this$props9.deletePermissions,
          setPermissionLoading = _this$props9.setPermissionLoading,
          enableLoading = _this$props9.enableLoading,
          disableLoading = _this$props9.disableLoading,
          _this$props9$menuConf = _this$props9.menuConfig,
          menuConfig = _this$props9$menuConf === void 0 ? {} : _this$props9$menuConf,
          currentRoleCode = _this$props9.currentRoleCode;
      var _menuConfig$controlle = menuConfig.controllerType,
          controllerType = _menuConfig$controlle === void 0 ? [] : _menuConfig$controlle;
      var _tenantMenuManage$cod = tenantMenuManage.code,
          code = _tenantMenuManage$cod === void 0 ? {} : _tenantMenuManage$cod,
          list = tenantMenuManage.list,
          _tenantMenuManage$ten = tenantMenuManage.tenantData,
          tenantData = _tenantMenuManage$ten === void 0 ? {} : _tenantMenuManage$ten,
          _tenantMenuManage$men = tenantMenuManage.menuPrefixList,
          menuPrefixList = _tenantMenuManage$men === void 0 ? [] : _tenantMenuManage$men,
          _tenantMenuManage$men2 = tenantMenuManage.menuTypeList,
          menuTypeList = _tenantMenuManage$men2 === void 0 ? [] : _tenantMenuManage$men2,
          _tenantMenuManage$sit = tenantMenuManage.siteLabelList,
          siteLabelList = _tenantMenuManage$sit === void 0 ? [] : _tenantMenuManage$sit,
          _tenantMenuManage$ten2 = tenantMenuManage.tenantLabelList,
          tenantLabelList = _tenantMenuManage$ten2 === void 0 ? [] : _tenantMenuManage$ten2;
      var _tenantData$content = tenantData.content,
          content = _tenantData$content === void 0 ? [] : _tenantData$content;
      var _this$state = this.state,
          editorVisible = _this$state.editorVisible,
          currentRowData = _this$state.currentRowData,
          permissionSetVisible = _this$state.permissionSetVisible,
          isCopy = _this$state.isCopy,
          recordCreateFlag = _this$state.recordCreateFlag,
          processingEnableRow = _this$state.processingEnableRow,
          isEdit = _this$state.isEdit,
          _this$state$expandedR = _this$state.expandedRowKeys,
          expandedRowKeys = _this$state$expandedR === void 0 ? [] : _this$state$expandedR;
      var effects = {
        queryPermissions: queryPermissions,
        queryParentDir: queryParentDir,
        queryTreeListLoading: queryTreeListLoading,
        queryPermissionSetTree: queryPermissionSetTree,
        queryPermissionsById: queryPermissionsById,
        queryPermissionsByIdAll: queryPermissionsByIdAll,
        queryLovsByIdAll: queryLovsByIdAll,
        queryCopyMenuListLoading: queryCopyMenuListLoading,
        copyCreateLoading: copyCreateLoading,
        saveMenuLoading: saveMenuLoading,
        createMenuLoading: createMenuLoading,
        queryPermissionsByMenuId: queryPermissionsByMenuId,
        queryLovByMenuId: queryLovByMenuId,
        assignPermissions: assignPermissions,
        deletePermissions: deletePermissions,
        setPermissionLoading: setPermissionLoading
      };
      var listProps = {
        path: path,
        content: content,
        dispatch: dispatch,
        menuTypeList: menuTypeList,
        onCopy: this.copy,
        queryTreeListLoading: queryTreeListLoading,
        menuDataSource: list.dataSource,
        levelCode: code['CIAM.RESOURCE_LEVEL'],
        onExpand: this.onClickExpand,
        handleEdit: this.edit.bind(this),
        handleEnable: this.setMenuEnable.bind(this),
        handleEditPermissionSet: this.openPermissionSetDrawer,
        onCreate: this.create,
        processingEnableRow: processingEnableRow,
        processing: {
          delete: effects.deleteMenu,
          query: effects.queryTreeList,
          setEnable: effects.setMenuEnable,
          enableLoading: enableLoading,
          disableLoading: disableLoading
        },
        id: id,
        expandedRowKeys: expandedRowKeys
      };
      var editorProps = {
        path: path,
        menuPrefixList: menuPrefixList,
        menuTypeList: menuTypeList,
        visible: editorVisible,
        handleCheckMenuDirExists: this.checkMenuDirExists,
        levelCode: code['CIAM.RESOURCE_LEVEL'],
        onCancel: this.closeEditor,
        dataSource: currentRowData,
        fetchCopyMenuList: this.fetchCopyMenuList,
        handleQueryDir: this.fetchDir,
        handleQueryPermissions: this.fetchMenuPermissions,
        handleQueryPermissionsBySet: this.fetchPermissionsById,
        handleCopyCreate: this.handleCopyCreate,
        handleCreate: this.createDir.bind(this),
        queryLabel: this.handleQueryMenuLabel.bind(this),
        siteLabelList: siteLabelList,
        tenantLabelList: tenantLabelList,
        processing: {
          queryPermissions: effects.queryPermissions,
          queryDir: effects.queryParentDir,
          queryCopyMenu: effects.queryCopyMenuListLoading,
          copyCreate: effects.copyCreateLoading,
          save: effects.saveMenuLoading,
          create: effects.createMenuLoading
        },
        isCopy: isCopy,
        recordCreateFlag: recordCreateFlag,
        processingEnableRow: processingEnableRow,
        id: id,
        isEdit: isEdit,
        handleSave: this.saveDir.bind(this)
      };
      var permissionSetProps = {
        path: path,
        controllerType: controllerType,
        currentRoleCode: currentRoleCode,
        visible: permissionSetVisible,
        menuDataSource: currentRowData,
        close: this.closePermissionSetDrawer,
        handleQueryList: this.fetchPermissionSetTree,
        handleQueryPermissionsBySet: this.fetchPermissionsByIdAll,
        // 查询权限集下已分配的权限
        handleQueryPermissions: this.fetchPermissionsByMenuId.bind(this),
        // 查询权限集下可分配的所有权限
        handleQueryLovsBySet: this.fetchLovsByIdAll.bind(this),
        // 查询权限集下已分配的Lov
        handleQueryLovs: this.fetchLovByMenuId.bind(this),
        // 查询权限集下可分配的所有Lov
        onAssignPermissions: this.assignPermissions.bind(this),
        onDeletePermissions: this.deletePermissions.bind(this),
        handleSave: this.savePermissionSet.bind(this),
        handleCreate: this.createPermissionSet.bind(this),
        handleEnable: this.setPermissionSetEnable.bind(this),
        // refreshRoutePermissionSetLoading: effects.refreshRoutePermissionSetLoading,
        processing: {
          query: effects.queryPermissionSetTree,
          save: effects.saveDir,
          create: effects.createDir,
          queryPermissionsById: effects.queryPermissionsById,
          queryPermissionsByIdAll: effects.queryPermissionsByIdAll,
          // 已分配的权限
          queryPermissionsByMenuId: effects.queryPermissionsByMenuId,
          // 可分配的权限
          queryLovsByIdAll: effects.queryLovsByIdAll,
          // 已分配的Lov
          queryLovByMenuId: effects.queryLovByMenuId,
          // 可分配的Lov
          assignPermissions: effects.assignPermissions,
          // 分配权限
          deletePermissions: effects.deletePermissions,
          // 删除权限
          setPermissionLoading: effects.setPermissionLoading // 启用/禁用 权限集

        } // save:

      };
      return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Header, {
        backPath: "/ciam/tenant-menu-manage/list",
        title: intl.get('ciam.tenantMenu.view.message.detailTitle').d('菜单详情')
      }, /*#__PURE__*/React.createElement(ButtonPermission, {
        permissionList: [{
          code: "".concat(path, ".button.create"),
          type: 'button',
          meaning: '菜单配置-新建'
        }],
        type: "primary",
        icon: "plus",
        onClick: function onClick() {
          return _this6.create({}, false);
        }
      }, intl.get('cpaas.common.button.create').d('新建')), /*#__PURE__*/React.createElement(Button, {
        icon: "sync",
        onClick: this.handleRefresh.bind(this),
        disabled: effects.queryTreeListLoading
      }, intl.get("".concat(commonPrompt, ".button.refresh")).d('刷新')), /*#__PURE__*/React.createElement(Button, {
        icon: "up",
        onClick: this.collapseAll.bind(this),
        disabled: effects.queryTreeListLoading
      }, intl.get("".concat(commonPrompt, ".button.collapseAll")).d('全部收起')), /*#__PURE__*/React.createElement(Button, {
        icon: "down",
        onClick: this.expandAll.bind(this),
        disabled: effects.queryTreeListLoading
      }, intl.get("".concat(commonPrompt, ".button.expandAll")).d('全部展开'))), /*#__PURE__*/React.createElement(Content, null, /*#__PURE__*/React.createElement("div", {
        className: styles['ciam-tenant-menu-table']
      }, /*#__PURE__*/React.createElement(ListTable, listProps)), editorVisible && /*#__PURE__*/React.createElement(Editor, editorProps), /*#__PURE__*/React.createElement(PermissionSet, permissionSetProps)));
    }
  }]);

  return TenantMenuManage;
}(React.Component), (_applyDecoratedDescriptor(_class2.prototype, "handleQueryLabel", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "handleQueryLabel"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleFetchData", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "handleFetchData"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchAssignLevelCode", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchAssignLevelCode"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchDir", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchDir"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchMenuPermissions", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchMenuPermissions"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchPermissionSetTree", [_dec8], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchPermissionSetTree"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchPermissionsById", [_dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchPermissionsById"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchPermissionsByIdAll", [_dec10], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchPermissionsByIdAll"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchLovsByIdAll", [_dec11], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchLovsByIdAll"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "copy", [_dec12], Object.getOwnPropertyDescriptor(_class2.prototype, "copy"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "fetchCopyMenuList", [_dec13], Object.getOwnPropertyDescriptor(_class2.prototype, "fetchCopyMenuList"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "handleCopyCreate", [_dec14], Object.getOwnPropertyDescriptor(_class2.prototype, "handleCopyCreate"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "checkMenuDirExists", [_dec15], Object.getOwnPropertyDescriptor(_class2.prototype, "checkMenuDirExists"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "openPermissionSetDrawer", [_dec16], Object.getOwnPropertyDescriptor(_class2.prototype, "openPermissionSetDrawer"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "closePermissionSetDrawer", [_dec17], Object.getOwnPropertyDescriptor(_class2.prototype, "closePermissionSetDrawer"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "closeEditor", [_dec18], Object.getOwnPropertyDescriptor(_class2.prototype, "closeEditor"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "create", [_dec19], Object.getOwnPropertyDescriptor(_class2.prototype, "create"), _class2.prototype)), _class2)) || _class) || _class);
export { TenantMenuManage as default };